<template>
	<view class="look">
		<view class="swiper" id="timer">
			<!-- <image :src="img" class="banner_img" mode="aspectFill"></image> -->
			<swiper class="swiper" style="height: 100%" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" @change="change" indicator-color="#999999">
				<swiper-item v-for="(item, index) in list" :key="index" @click="to(item)">
					<view class="swiper-item" style="height: 100%">
						<image :src="item" class="banner_img" mode="scaleToFill"></image>
					</view>
				</swiper-item>
			</swiper>
		</view>
		<view class="button">
			<view class="button_1" @click.stop="islogin" v-if="indicatorDots">{{$t('跳过')}}</view>
		</view>
		<!-- <view class="button_word" @click.stop="islogin" v-if="!indicatorDots">
			<view>开启体验</view>
		</view> -->

		<view class="iphonex"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 轮播图参数
				indicatorDots: true,
				autoplay: false,
				interval: 1500,
				duration: 500,
				circular: false,
				img: '',
				timer: '',
				list: []
			};
		},
		onLoad() {
			this.onloading();
		},
		onShow() {},
		methods: {
			onloading() {
				this.list.push('https://img.alicdn.com/imgextra/i4/2215984279448/O1CN013j03aP2JfEvqBO60D_!!2215984279448.png');
				this.indicatorDots = false;
				this.timer = setTimeout(() => {
					clearTimeout(this.timer);
					uni.reLaunch({
						url: '/pages/tabBar/home'
					});
				}, 1500);
				// const platform = uni.getSystemInfoSync().platform;
				// if (platform === 'ios') {
				// 	getIosBoot().then((res) => {
				// 		console.log(res, 'g212121');
				// 		this.list.push(res.data.img);
				// 		this.indicatorDots = false;
				// 		this.timer = setTimeout(() => {
				// 			clearTimeout(this.timer);
				// 			uni.reLaunch({
				// 				url: '/pages/tabBar/control/control'
				// 			});
				// 		}, 1500);
				// 	});
				// } else {
				// 	getAndroidBoot().then((res) => {
				// 		console.log(res, 'g212121');
				// 		this.list.push(res.data.img);
				// 		this.indicatorDots = false;
				// 	});
				// 	this.timer = setTimeout(() => {
				// 		clearTimeout(this.timer);
				// 		uni.reLaunch({
				// 			url: '/pages/tabBar/control/control'
				// 		});
				// 	}, 1500);
				// }
				// if(uni.getSystemInfoSync().platform !== "ios" ){
				// 	uni.reLaunch({
				// 		url: '/pages/tabBar/control/control'
				// 	})
				// 	return false
				// }
				// getIosBoot().then(res => {
				// 	console.log(res ,'212')
				// 	if (res.code == 200) {
				// 		this.img = res.data.img;
				// 		this.timer = setTimeout(() => {
				// 			clearTimeout(this.timer)
				// 			uni.reLaunch({
				// 				url: '/pages/tabBar/control/control'
				// 			})
				// 		}, 1500)
				// 	} else {
				// 		// this.$message.info(res.data.msg)
				// 	}
				// })
			},
			change(e) {
				console.log(e.target.current);
				if (this.list.length - 1 == e.target.current) {
					this.indicatorDots = false;
				} else {
					this.indicatorDots = true;
				}
			},
			// 判断是否登录
			islogin() {
				uni.reLaunch({
					url: '/pages/tabBar/control/control'
				});
			},
			// 点击轮播图进行跳转
			to(e) {}
		}
	};
</script>

<style>
	page {
		background-color: black;
	}
</style>
<style lang="less" scoped>
	/deep/ uni-swiper .uni-swiper-dots-horizontal {
		bottom: 130rpx !important;
	}

	/deep/ uni-swiper .uni-swiper-dot {
		width: 22rpx;
		height: 22rpx;
		background: #ffffff;
		opacity: 1;
		border-radius: 19rpx;
	}

	// /deep/ uni-swiper .uni-swiper-dots-horizontal .uni-swiper-dot {
	// 	margin-right: 38rpx;
	// }

	// /deep/ uni-swiper .uni-swiper-dot-active {
	// 	width: 66rpx !important;
	// }

	.look {
		height: 100vh;

		.img {
			height: 100vh;
		}
	}

	.swiper {
		width: 100%;
		height: 100vh;

		.banner_img {
			height: 100%;
			width: 100%;
		}
	}

	.button {
		position: fixed;
		z-index: 1;
		top: calc(30rpx + var(--status-bar-height));
		right: 30rpx;

		.button_1 {
			height: 50rpx;
			line-height: 50rpx;
			// border: 1rpx solid #999999;
			opacity: 1;
			border-radius: 32rpx;
			padding: 0 36rpx;
			font-size: 24rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #ffffff;
			background-color: #000000;
		}
	}

	.button_word {
		width: 100%;
		position: fixed;
		z-index: 1;
		bottom: 79rpx;
		display: flex;
		justify-content: center;

		view {
			width: 400rpx;
			height: 72rpx;
			text-align: center;
			line-height: 72rpx;
			background: rgba(0, 0, 0, 0.6);
			opacity: 1;
			border-radius: 36rpx;
			font-size: 28rpx;
			color: #ffffff;
		}
	}
</style>